package com.kcsj.domain.user;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Collection;
/**
 * @author 胡庆阳
 * 29th Nov. 2020
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Resource implements Comparable<Resource>, Serializable {
    private Integer id;
    private Integer pid;
    private String type;
    private String url;
    private String description;
    private String icon;
    private String operating;
    private String remarks;
    private Collection<String> authorities;
    private Collection<Resource> children;

    public Resource(Integer id, Integer pid,String type,String url, String description,String icon, String remarks,Collection<String> authorities,Collection<Resource> children) {
        this.id = id;
        this.pid = pid;
        this.type = type;
        this.url = url;
        this.description = description;
        this.icon = icon;
        this.remarks = remarks;
        this.authorities = authorities;
        this.children = children;
    }

    public Resource(Integer id, Integer pid,String type, String url, String description,String icon, String remarks, Collection<Resource> children) {
        this.id = id;
        this.pid = pid;
        this.type = type;
        this.url = url;
        this.description = description;
        this.icon = icon;
        this.remarks = remarks;
        this.children = children;
    }

    @Override
    public int compareTo(Resource other) {
        // id为排序依据
        return this.id - other.id;
    }

}
